package com.zzl.oop;

/**
 * 懒汉式
 * 使用时实例化对象
 * @author Administrator
 *
 */
public class SingletonPattern {

	//对象私有化不允许被创建
	private static SingletonPattern singleton;
	
	//构造函数私有化不允许被创建
	private SingletonPattern(){
		
	}
	
	public static synchronized  SingletonPattern getInstance(){
		if(singleton == null){
			singleton = new SingletonPattern();
		}
		
		return singleton;
	}
	
}
